package com.lemon.core.base.constant;

import lombok.experimental.UtilityClass;

/**
 * 用户认证授权相关常量类
 *
 * @author pan
 * @since 2018-03-22
 */
@UtilityClass
public class SecurityConstants {

    /**
     * 请求头租户ID，请求头中会将key全部转小写
     */
    public static final String TENANT_ID_KEY = "tenant-id";

    /**
     * 租户ID
     */
    public static final String TENANT_ID = "tenantId";

    /**
     * 认证请求头key
     */
    public static final String AUTHORIZATION_KEY = "Authorization";

    /**
     * JWT令牌前缀
     */
    public static final String JWT_PREFIX = "Bearer ";

    /**
     * Basic认证前缀
     */
    public static final String BASIC_PREFIX = "Basic ";

    /**
     * JWT载体key
     */
    public static final String JWT_PAYLOAD_KEY = "payload";

    /**
     * JWT ID 唯一标识
     */
    public static final String JWT_JTI = "jti";

    /**
     * JWT 超时时间
     */
    public static final String JWT_EXP = "exp";

    /**
     * 黑名单token前缀
     */
    public static final String TOKEN_BLOCKLIST_PREFIX = "auth:token:blocklist:";

    public static final String USER_ID_KEY = "userId";

    public static final String USER_NAME_KEY = "username";

    public static final String CLIENT_ID_KEY = "client_id";

    public static final String MOBILE_KEY = "mobile";

    public static final String PASSWORD_KEY = "password";

    public static final String CODE_KEY = "code";

    public static final String UUID_KEY = "uuid";

    public static final String ROLES_KEY = "roles";

    public static final String ROOT_ROLE_KEY = "rootRole";

    /**
     * JWT存储权限前缀
     */
    public static final String AUTHORITY_PREFIX = "ROLE_";

    /**
     * JWT存储权限属性
     */
    public static final String JWT_AUTHORITIES_KEY = "authorities";

    public static final String GRANT_TYPE_KEY = "grant_type";

    public static final String REFRESH_TOKEN_KEY = "refresh_token";

    public static final String APP_API_PATTERN = "/*/app-api/**";

    /**
     * 认证方式
     */
    public static final String AUTHENTICATION_METHOD = "authenticationMethod";

    /**
     * 短信验证码key前缀
     */
    public static final String SMS_CODE_PREFIX = "SMS_CODE:";

}
